#include <54func.h>
int main(int argc,char *argv[])
{
    //目录流是循环打印的，但是目前我需要打印dir2的目录（其中一个）
    ARGS_CHECK(argc,2);
    DIR *dirp = opendir(argv[1]);
    ERROR_CHECK(dirp,NULL,"opendir");
    struct dirent * pdirent;
    long loc;
    while((pdirent = readdir(dirp)) != NULL)
    {
        printf("inode = %ld,name = %s,reclen = %d,type = %d\n",
               pdirent->d_ino,pdirent->d_name,pdirent->d_reclen,pdirent->d_type);
        if(strcmp("dir2", pdirent->d_name)==0)
        {
            loc = telldir(dirp);//telldir:用于获取当前文件的位置信息，在这里我们想要回头查询dir2目录的信息
        }
    }
    printf("-------------------------------\n");
    seekdir(dirp,loc);
    pdirent = readdir(dirp);
    printf("inode = %ld,name = %s,reclen = %d,type = %d\n",
            pdirent->d_ino,pdirent->d_name,pdirent->d_reclen,pdirent->d_type);
    closedir(dirp);
    return 0;
}
